package com.pine.app.module.security.oauth.support.refresh;

import com.pine.app.module.security.core.common.AuthConstant;
import com.pine.app.module.security.oauth.support.AbstractHttpTokenRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * @author xiaoyuan
 * @create 2019/9/30 14:39
 **/
public class HttpRefreshTokenRequest extends AbstractHttpTokenRequest implements RefreshTokenRequest {
    public HttpRefreshTokenRequest(HttpServletRequest request) {
        super(request);
    }

    @Override
    public String getClientId() {
        return clientCredentials.getPrincipal();
    }

    @Override
    public String getClientSecret() {
        return clientCredentials.getCredentials();
    }

    @Override
    public String getRefreshToken() {
        return getParameter(AuthConstant.refresh_token).orElse(null);
    }
}
